package org.easydev.base.webbase.bo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@AllArgsConstructor
@NoArgsConstructor
@Data
@ToString
public class PageData<T> implements Serializable {
    @Serial
    private static final long serialVersionUID = -3505719368753191234L;

    private Long pageNo;

    private Long pageSize;

    private Long total;

    private List<T> content;

    public static <T> Builder<T> builder() {
        return new Builder<>();
    }


    public static class Builder<T> {
        private final PageData<T>  pageData = new PageData<>();

        public Builder<T> pageNo(Long pageNo) {
            pageData.pageNo = pageNo;
            return this;
        }

        public Builder<T> pageSize(Long pageSize) {
            pageData.pageSize = pageSize;
            return this;
        }

        public Builder<T> total(Long total) {
            pageData.total = total;
            return this;
        }

        public Builder<T> content(List<T> content) {
            pageData.content = content;
            return this;
        }

        public PageData<T> build() {
            return pageData;
        }
    }

}
